import { BullModule } from "@nestjs/bull";
import { Global, Module } from "@nestjs/common";
import config from "src/config";
import { QueuesService } from "./queues.sevice";
import { QueuesConsumer } from "./queues.consumer";

@Global()
@Module({
	imports: [
		BullModule.forRoot({
			redis: {
				host: config.redis.host,
				port: config.redis.port,
				password:config.redis.password,
				db:15
			},
		}),
		BullModule.registerQueue({
			name:'message-queue'
		}),
	],
	providers: [QueuesService,QueuesConsumer],
	exports: [QueuesService,QueuesConsumer],
})
export class QueuesModule { }
